home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_PRO / VIEWS.ZIP;1 / CVDZIP.EXE / CVPLATFM.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-12  |  3.0 KB  |  138 lines

  1. /*
  2.     cvplatfm.cpp
  3.  
  4.     List of platforms window
  5.     
  6.     C++/Views 2.0 Demo
  7.     Copyright (c) 1992, by Liant Software Corp.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.     10/12/92 jmd    changed radio buttons to list box
  13. */
  14.  
  15. #include "cvplatfm.h"
  16. #include "cvdemovw.h"
  17. #include "brush.h"
  18. #include "font.h"
  19. #include "listbox.h"
  20. #include "editbox.h"
  21. #include "messengr.h"
  22.  
  23. defineClass(PlatformView, VMdiView)
  24.  
  25. char *platBttns[] = { "MS Windows", "OS/2 PM", "Motif", "Others", 0 };
  26.  
  27. PlatformView::PlatformView()
  28. {
  29.     ;
  30. }
  31.  
  32. PlatformView::PlatformView(VFrame &f, DemoAppView *parent)
  33.     : VMdiView("PlatformIcon", f, (VWindow *) parent, StyleBorder | StyleTitle | StyleCloseBox | StyleSizable)
  34. {
  35.     mainWin = parent;
  36.     platform = 0;
  37.  
  38.     setTitle("C++/Views Supported Platforms");
  39.  
  40.     msgFont = new VFont("Arial", 10);
  41.     listFont = new VFont("Arial", 14);
  42.  
  43.     /* create an edit box to display message in */
  44.     msgBox = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
  45.                     StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
  46.  
  47.     msgBox->setFont(msgFont);
  48.     msgBox->putText(cvTextFile->getMessage("Platform:Windows").gets());
  49.  
  50.     /* create a list box */
  51.     VListBox *listBox;
  52.     listBox = new VListBox(VFrame(0.05F, 0.05F, 0.9F, 0.4F), this, StyleBorder);
  53.     listBox->uponClick(this, methodOf(PlatformView, singleClick),
  54.                              methodOf(PlatformView, doubleClick));
  55.  
  56.     listBox->setFont(listFont);
  57.  
  58.     /* put entries into list box */
  59.     listBox->appendString("MS Windows");
  60.     listBox->appendString("OS/2 PM");
  61.     listBox->appendString("Motif");
  62.     listBox->appendString("Others");
  63.  
  64.     /* make sure the "About this Window" data is set up */
  65.     mainWin->setAboutNames("Platform:About", "cvplatfm.cpp");
  66. }
  67.  
  68. PlatformView::~PlatformView()
  69. {
  70.     /* destroy background brush (if present) */
  71.     delete getBackground();
  72.  
  73.     delete listFont;
  74.     delete msgFont;
  75. }
  76.  
  77. boolean PlatformView::free()
  78. {
  79.     delete this;
  80.     return(TRUE);
  81. }
  82.  
  83. boolean PlatformView::close()
  84. /*
  85.     The user has closed the window.
  86.     Notify the main window so that it can update the main menu bar
  87. */
  88. {
  89.     mainWin->platformView = 0;
  90.     mainWin->updateMenu();
  91.     return(FALSE);
  92. }
  93.  
  94. boolean PlatformView::singleClick(int index)
  95. /*
  96.     Mouse clicked in list box.
  97. */
  98. {
  99.     platform = index;
  100.  
  101.     switch(platform) {
  102.     case 0:
  103.         msgBox->putText(cvTextFile->getMessage("Platform:Windows").gets());
  104.         break;
  105.     case 1:
  106.         msgBox->putText(cvTextFile->getMessage("Platform:PM").gets());
  107.         break;
  108.     case 2:
  109.         msgBox->putText(cvTextFile->getMessage("Platform:Motif").gets());
  110.         break;
  111.     case 3:
  112.         msgBox->putText(cvTextFile->getMessage("Platform:Others").gets());
  113.         break;
  114.     }
  115.  
  116.     return(TRUE);
  117. }
  118.  
  119. boolean PlatformView::doubleClick(int index)
  120. /*
  121.     Mouse double-clicked in list box.
  122. */
  123. {
  124.     return(TRUE);
  125. }
  126.  
  127. boolean PlatformView::givenFocus()
  128. /*
  129.     Our window has just been given input focus
  130. */
  131. {
  132.     /* set the data for the About this Window dialog */
  133.     mainWin->setAboutNames("Platform:About", "cvplatfm.cpp");
  134.  
  135.     /* carry on with default window behavior, return FALSE */
  136.     return(FALSE);
  137. }
  138.